% latexlng.doc [ ==> language.sty ] 28 Sep 90 %------------------------------------------------------------ % (c) 1990 by J.Schrod. Copyright conditions below. % support for language switches % LaTeX style option [language] % documented with MAKEPROG % VERSION HISTORY (MSCF -- most significant change first) % DATE WHO REMARK % 90-09-28 js first release % bug reports to: % TU Darmstadt % Institut f\"ur Theoretische Informatik % Joachim Schrod % Alexanderstr. 10 % D-6100 Darmstadt % FR Germany % Tel. (+ 6151) 16 3711 % Bitnet: XITIJSCH@DDATHD21 % author: % js: Joachim Schrod % contributors: % (-: place enough for your name! :-) %%%% These TeX macros were documented with the documentation system %%%% MAKEPROG and automatically converted to the current form. %%%% If you have MAKEPROG available you may transform it back to %%%% the original input: Remove every occurence of three percents %%%% and one optional blank from the beginning of a line and remove %%%% every line which starts with four percents. The following lex %%%% program will do this: %%%% %% %%%% ^%%%\ ? ; %%%% ^%%%%.*\n ; %%%% MAKEPROG may be obtained over the net from the Bitnet-Listserver %%%% LISTSERV@DHDURZ1 (filelist WEBWARE), from tuglib@science.utah.edu, %%%% or via ftp from june.cs.washington.edu. %%% \documentstyle[progltx]{article} %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% % %%% % local macros %%% % %%% \let\mc=\small % for names like GNU %%% \def\GNU{{\mc GNU}} %%% % %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% \begin{document} %%% \title{Different Languages in \LaTeX{}} %%% \author{Joachim Schrod} %%% \maketitle %%% \chap Introduction. %%% \TeX{} 3 supports the creation of documents in different languages %%% with only one preloaded format because different sets of hyphenation %%% patterns may be included. To switch between these pattern sets the %%% primitive counter |\language| is provided. %%% The macro file |language.tex| (``Different Languages in \TeX{},'' %%% written by me) creates a user interface for the switch between %%% languages on a higher level. Languages or dialects of languages may %%% be defined as {\it language entities}, for every entity token lists %%% (``{\it hooks\/}'') may be registered which are executed on a switch %%% to this language or this dialect. %%% But the user interface of |language.tex| is not \LaTeX{}-like, the %%% normal user wants a \LaTeX{} environment. The style option %%% |language.sty| defines the environments |language| and |language*|. %%% It is usable with all styles which do not use |\language| after %%% |\the| because |\language| had to be redefined. Of course all other %%% markups in |language.tex| may still be used -- for the definition of %%% language entities these markups even must be used. %%% \sect The following environments are provided: %%% % %%% \begin{quote}\obeylines %%% |\begin{language}{|{\it language entity\/}|}| %%% \noindent \vdots %%% |\end{language}| %%% \end{quote} %%% % %%% executes the associated hook for the given language entity and %%% typesets the text within the environment with the associated %%% hyphenation patterns. |language| is a paragraph-making environment, %%% i.e., the breaking up of the text to lines is done completely within %%% this environment. This is needed because the hook may establish new %%% values for layout parameters (like |\hyphenpenalty|) that should be %%% used. %%% If no paragraph shall be made by this environment, |language*| may %%% be used as the environment name. If the hook shall not be executed %%% |\language| may be set as in Plain \TeX{} -- but it may not be %%% accessed via |\the\language|! %%% \sect This program is free software; you can redistribute it and/or %%% modify it under the terms of the \GNU{} General Public License as %%% published by the Free Software Foundation; either version~1, or (at your %%% option) any later version. %%% This program is distributed in the hope that it will be useful, but %%% {\bf without any warranty\/}; without even the implied warranty of %%% {\bf merchantability\/} or {\bf fitness for a particular purpose}. See %%% the \GNU{} General Public License for more details. %%% You should have received a copy of the \GNU{} General Public License %%% along with this program; if not, write to the Free Software Foundation, %%% Inc., 675~Mass Ave, Cambridge, MA~02139, USA. %%% \sect Because the beginning of an environment in \LaTeX{} is defined %%% by a control sequence with the same name we must redefine %%% |\language|. We just look if the next token is a begin-group token %%% (i.e.\ a `|{|'), then an environment is begun. Otherwise we assume %%% that a Plain-like assignment should be done, in case no numeric value %%% follows the user will get an error message. %%% \beginprog \def\language{% \@ifnextchar \bgroup \BeginLanguage \@@language \def\endlanguage{\endgraf \EndLanguage} %%% \endprog %%% \sect The |language*| environment is easier: We have no name conflicts %%% and map it directly to |\BeginLanguage| and |\EndLanguage|. %%% \beginprog \newenvironment{language*}{\BeginLanguage}{\EndLanguage} %%% \endprog %%% \sect We are finished. %%% \beginprog \endinput %%% \endprog %%% \end{document}